<?php
    require_once "../../config.php";
    require_once "../../functions.php";
    //获取前端传递的id
    $categoryId = $_POST["categoryId"];
    //连接数据库
    $connect = connect();
    //sql语句
    $delSql = "DELETE from categories where id = {$categoryId}";
    //执行sql
    $result = mysqli_query($connect,$delSql);
    
    $response = ["code"=>0,"msg"=>"操作失败"];
    //判断是不是删除成功
    if($result){
        $response["code"] = 1;
        $response["msg"] = "操作成功";
    }
    header("content-type:application/json;charset=ut8");
    echo json_encode($response);

?>